﻿using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            var time = DateTime.Now;

            Console.WriteLine("时间:" + time);
            //时间
            var aDate = time.AddDays(-1);

            Console.WriteLine(aDate);

            Console.WriteLine(aDate.Day);

            Console.WriteLine();
            //
            string n = "    今天很飘      ";

            Console.WriteLine(n.Length);
            //查找
            Console.WriteLine(n.IndexOf("天"));

            Console.WriteLine(n.LastIndexOf("飘"));
            //字符串删除
            Console.WriteLine(n.Remove(0, 3));
            //去空格
            Console.WriteLine(n.TrimStart());

            Console.WriteLine(n.TrimEnd());
            //添加空格
            Console.WriteLine(n.PadLeft(100));

            Console.WriteLine(n.PadRight(1));

            //改写字符串内容
            Console.WriteLine(n.Replace("今", "和"));
            //截取字符串 
            Console.WriteLine(n.Substring(0, 6));
            //插入字符串
            Console.WriteLine(n.Insert(2, "能"));

        }
    }
}
